﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace 定时喝水
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            this.Visible = false;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            timer1.Interval = 1000;
        }

        
        private void timer1_Tick(object sender, EventArgs e)
        {
            if ((DateTime.Now.Hour % f2._T_Hour == 0) && (DateTime.Now.Minute == f2._T_Min) && (DateTime.Now.Second == f2._T_Sec))
            {
                label1.Text = DateTime.Now.ToString();
                this.Visible = true;
                timer1.Stop();
                MessageBox.Show(f2._VoteStr);
                this.Visible = false;
                timer1.Start();
            }            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Visible = false;
            timer1.Start();
            timer1.Interval = 1000;
        }

        private Form2 f2;
        private void button_Set_Click(object sender, EventArgs e)
        {           
            f2 = new Form2();
            f2.Show(this);
        }       
    }
}
